home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Eagles Nest BBS 8
/
Eagles_Nest_Mac_Collection_Disc_8.TOAST
/
Developer Tools⁄Additions
/
MacTCPToolBx
/
TCP XCMD Example
/
background_2599.txt
< prev
next >
Wrap
Text File
|
1989-06-01
|
9KB
|
389 lines
-- background: 2599 from stack: in
-- bmap block id: 3901
-- flags: 0000
-- background id: 0
-- name:
----- HyperTalk script -----
on idle
global connectionID
--put the heapSpace
if connectionID is empty then
put "no connection" into field "state"
exit idle
end if
get TCPState(connectionID)
put it into field "state"
if it is not "established" then exit idle
put TCPRecvUpTo(connectionID,return,10,empty) into newInput
if newInput is not empty then
get rect of field "screen"
get (item 4 of it) - (item 2 of it)
put (it div (the textHeight of field "screen"))-1 into linesAvail
get field "screen" & newInput
put the number of lines in it into linesThere
if linesThere > linesAvail then
delete line 1 to (linesThere-linesAvail) of it
end if
put it into field "screen"
end if
end idle
on openCard
global connectionID
put empty into connectionID
end openCard
on closeCard
global connectionID
if connectionID is not empty then
TCPRelease connectionID
put empty into connectionID
end if
end closeCard
-- part 43 (field)
-- low flags: 02
-- high flags: 4000
-- rect: left=127 top=209 right=223 bottom=331
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: hostName
----- HyperTalk script -----
on closeField
put TCPNameToAddr(field "hostName") into field "address"
end closeField
-- part 26 (field)
-- low flags: 02
-- high flags: 4000
-- rect: left=22 top=232 right=248 bottom=265
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: address
-- part 2 (field)
-- low flags: 01
-- high flags: 0001
-- rect: left=18 top=26 right=163 bottom=493
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: screen
-- part 7 (button)
-- low flags: 00
-- high flags: 0004
-- rect: left=411 top=297 right=326 bottom=443
-- title width / last selected line: 0
-- icon id / first selected line: 21700 / 21700
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Home
----- HyperTalk script -----
on mouseUp
visual effect iris open
go Home
end mouseUp
-- part 18 (button)
-- low flags: 00
-- high flags: 0004
-- rect: left=367 top=297 right=326 bottom=399
-- title width / last selected line: 0
-- icon id / first selected line: 2478 / 2478
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Home
----- HyperTalk script -----
on mouseUp
visual effect iris open
go to next card
end mouseUp
-- part 27 (field)
-- low flags: 02
-- high flags: 4000
-- rect: left=208 top=248 right=264 bottom=265
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: port
-- part 28 (field)
-- low flags: 02
-- high flags: 4000
-- rect: left=208 top=264 right=280 bottom=265
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 65535
-- font id: 3
-- text size: 9
-- style flags: 0
-- line height: 12
-- part name: local port
-- part 29 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=26 top=259 right=274 bottom=95
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: ActiveOpen
----- HyperTalk script -----
on mouseUp
global connectionID
put TCPActiveOpen(item 1 of field "address", field "port", field "local port") into connectionID
if connectionID contains "fail" then
put "The Result:" && connectionID
put empty into connectionID
end if
end mouseUp
-- part 31 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=100 top=259 right=274 bottom=169
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: PassiveOpen
----- HyperTalk script -----
on mouseUp
global connectionID
put TCPPassiveOpen(item 1 of field "address",field "port", field "local port") into connectionID
if connectionID contains "fail" then
put "The Result:" && connectionID
put empty into connectionID
end if
end mouseUp
-- part 32 (button)
-- low flags: 00
-- high flags: C006
-- rect: left=274 top=282 right=298 bottom=331
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: CrLf
----- HyperTalk script -----
on mouseUp
set the hilite of bg button "CrLf" to true
set the hilite of bg button "Cr" to false
set the hilite of bg button "Nothing" to false
end mouseUp
-- part 33 (button)
-- low flags: 00
-- high flags: 8006
-- rect: left=274 top=296 right=312 bottom=331
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Cr
----- HyperTalk script -----
on mouseUp
set the hilite of bg button "Cr" to true
set the hilite of bg button "CrLf" to false
set the hilite of bg button "Nothing" to false
end mouseUp
-- part 34 (button)
-- low flags: 00
-- high flags: 8006
-- rect: left=274 top=310 right=326 bottom=331
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Nothing
----- HyperTalk script -----
on mouseUp
set the hilite of bg button "Nothing" to true
set the hilite of bg button "Cr" to false
set the hilite of bg button "CrLf" to false
end mouseUp
-- part 36 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=127 top=284 right=303 bottom=205
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: Send Line
----- HyperTalk script -----
on mouseUp
global connectionID
ask "Line to send:"
if it is not empty then
if the hilite of bg button "Cr" then
put return after it
else if the hilite of bg button "CrLf" then
put return & linefeed after it
end if
TCPSend connectionID,it
if the result is not empty then put "The Result:" && the result
if the optionKey is down then
put TCPRecvMsg(connectionID,1800,"2",10000) into newInput
if newInput is not empty then
get rect of field "screen"
get (item 4 of it) - (item 2 of it)
put (it div (the textHeight of field "screen"))-1 into linesAvail
get field "screen" & newInput
put the number of lines in it into linesThere
if linesThere > linesAvail then
delete line 1 to (linesThere-linesAvail) of it
end if
put it into field "screen"
end if
end if
end if
end mouseUp
-- part 37 (field)
-- low flags: 01
-- high flags: 0000
-- rect: left=66 top=308 right=326 bottom=205
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 2
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: state
-- part 40 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=19 top=169 right=184 bottom=93
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Clear Display
----- HyperTalk script -----
on mouseUp
put empty into field "screen"
end mouseUp
-- part 41 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=25 top=285 right=300 bottom=71
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Close
----- HyperTalk script -----
on mouseUp
global connectionID
TCPClose connectionID
if the result is not empty then put "The Result:" && the result
end mouseUp
-- part 42 (button)
-- low flags: 00
-- high flags: A002
-- rect: left=75 top=285 right=300 bottom=121
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: Release
----- HyperTalk script -----
on mouseUp
global connectionID
TCPRelease connectionID
if the result is not empty then put "The Result:" && the result
put empty into connectionID
end mouseUp